<template>
  <div>
    <!--<headerPage title="设备审批" small="Equipment for approval"></headerPage>-->
    <el-row>
      <el-col>
        <el-form :inline="true" :model="formInline">
          <el-form-item>
            <el-input size="mini" v-model="formInline.user" placeholder="请输入设备编号"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input size="mini" v-model="formInline.user" placeholder="请输入设备名称"></el-input>
          </el-form-item>
          <el-form-item>
            <el-select clearable size="mini" v-model="formInline.region" placeholder="请选择状态">
              <el-option label="出借" value="shanghai"></el-option>
              <el-option label="正常" value="beijing"></el-option>
              <el-option label="损坏" value="beijing2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item size="mini">
            <el-button type="primary" size="small">查询</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-row class="buttonList">
      <el-col>
        <el-button type="primary" size="mini">同意</el-button>
        <el-button type="danger" size="mini">驳回</el-button>
      </el-col>
    </el-row>
    <el-row>
      <el-col>
        <el-table
          :data="tableData"
          size="mini"
          border
          style="width: 100%">
          <el-table-column
                  align="center"
                  type="selection"
                  width="55">
          </el-table-column>
          <el-table-column
            align="center"
            prop="user"
            label="设备编号">
          </el-table-column>
          <el-table-column
            align="center"
            prop="email"
            label="设备名称">
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            label="放置地">
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            label="专业">
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            label="班级">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status"
            label="课程">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="人数">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="申请人">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="库存">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="预约日期">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status2"
            label="截止日期">
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            label="设备状态">
            <template slot-scope="scope">
              <el-tag
                type="primary"
                disable-transitions>出借</el-tag>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                background
                layout="total, sizes, prev, pager, next, jumper"
                :page-size="pagination.pageSize"
                :total="pagination.total"
                :page-sizes="[10, 20, 30, 50, 100]"
        >
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog title="设备预约" :visible.sync="dialogFormVisible" width="30%">
      <el-form :model="form" :label-width="formLabelWidth">
        <el-form-item label="设备编号">
          <el-input v-model="form.region" autocomplete="off" disabled></el-input>
        </el-form-item>
        <el-form-item label="设备名称">
          <el-input v-model="form.name" autocomplete="off" disabled></el-input>
        </el-form-item>
        <el-form-item label="专业">
          <el-select clearable v-model="form.region" placeholder="请选择专业">
            <el-option label="专业一" value="shanghai"></el-option>
            <el-option label="专业二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="班级">
          <el-select clearable v-model="form.region" placeholder="请选择班级">
            <el-option label="班级一" value="shanghai"></el-option>
            <el-option label="班级二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="责任人">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="赔付价格">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="是否赔付">
          <el-radio-group v-model="form.resource">
            <el-radio label="是"></el-radio>
            <el-radio label="否"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="日期">
          <el-col :span="11">
            <el-date-picker type="date" placeholder="选择使用日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
          </el-col>
          <el-col class="line" :span="2">-</el-col>
          <el-col :span="11">
            <el-date-picker type="date" placeholder="选择损坏日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
          </el-col>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog title="操作规程" :visible.sync="dialogFormVisible2" width="40%">
      <el-form :model="form2" :label-width="formLabelWidth">
        <!--<el-form-item label="设备名称">
          <el-input v-model="form2.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="设备编号">
          <el-input v-model="form2.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="设备二维码">
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card">
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog :visible.sync="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="">
          </el-dialog>
        </el-form-item>
        <el-form-item label="放置地">
          <el-input v-model="form2.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="入库时间">
          <el-date-picker
            v-model="form2.value"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="购置时间">
          <el-date-picker
            v-model="form2.value"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="贵重仪器">
          <el-radio-group v-model="form2.resource">
            <el-radio label="是"></el-radio>
            <el-radio label="否"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="低值易耗品">
          <el-radio-group v-model="form.resource">
            <el-radio label="是"></el-radio>
            <el-radio label="否"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="设备说明">
          <el-input v-model="form2.name" type="textarea"></el-input>
        </el-form-item>-->
        <el-form-item label="操作规程">
          <el-upload
            class="upload-demo"
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple
            :file-list="fileList"
            :limit="3">
            <!--<el-button size="small" type="primary">点击上传</el-button>-->
            <!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>-->
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible2 = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible2 = false">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog title="设备预约" :visible.sync="dialogFormVisible3" width="30%">
      <el-form :model="form3" :label-width="formLabelWidth">
        <el-form-item label="设备编号">
          <el-input v-model="form3.region" autocomplete="off" disabled></el-input>
        </el-form-item>
        <el-form-item label="设备名称">
          <el-input v-model="form3.name" autocomplete="off" disabled></el-input>
        </el-form-item>
        <el-form-item label="专业">
          <el-select clearable v-model="form3.region" placeholder="请选择专业">
            <el-option label="专业一" value="shanghai"></el-option>
            <el-option label="专业二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="班级">
          <el-select clearable v-model="form3.region" placeholder="请选择班级">
            <el-option label="班级一" value="shanghai"></el-option>
            <el-option label="班级二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="课程">
          <el-select clearable v-model="form3.region" placeholder="请选择课程">
            <el-option label="课程一" value="shanghai"></el-option>
            <el-option label="课程二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="人数">
          <el-select clearable v-model="form3.region" placeholder="请选择人数">
            <el-option label="人数一" value="shanghai"></el-option>
            <el-option label="人数二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="库存">
          <el-input v-model="form3.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="借还日期">
          <el-col :span="11">
            <el-date-picker type="date" placeholder="选择日期" v-model="form3.date1" style="width: 100%;"></el-date-picker>
          </el-col>
          <el-col class="line" :span="2" style="text-align: center">-</el-col>
          <el-col :span="11">
            <el-date-picker type="date" placeholder="选择日期" v-model="form3.date1" style="width: 100%;"></el-date-picker>
          </el-col>
        </el-form-item>
        <el-form-item label="延期日期">
          <el-date-picker type="date" placeholder="选择日期" v-model="form3.date1" style="width: 100%;"></el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible3 = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible3 = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "listManagement",
    data() {
      return{
        fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}],
        dialogImageUrl: '',
        dialogVisible: false,
        dialogFormVisible3: false,
        form: {},
        form3: {},
        dialogFormVisible: false,
        form2:{
          deviceName: [ {name: ''}, {num: 1212}]
        },
        formLabelWidth: '120px',
        dialogFormVisible2: false,
        formInline: {},
        pagination: {
          pageSize: 20,
          total: 1,
          pageNo: 1
        },
        data: [
          {
            label: '竞赛用仪器',
            children: [{
              label: 'PH试纸',
              children: [
                {label: 'A试纸'},
                {label: 'B试纸'}
              ]
            },
              {
                label: '试管',
                children: [
                  {label: 'A类试管'},
                  {label: 'B类试管'}
                ]
              }]
          },
          {
            label: '教学用仪器',
            children: [{
              label: '显微镜',
              children: [
                {label: 'A'},
                {label: 'B'}
              ]
            }]
          }
        ],
        tableData: [{
          user: 'A01',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '启用',
          status2: "正常"
        }, {
          user: 'A02',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '禁用',
          status2: '归档'
        }, {
          user: 'B01',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '禁用',
          status2: "正常"
        }, {
          user: 'B02',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '启用',
          status2: '归档'
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        }
      }
    },
    methods: {
      handleNodeClick(data) {
        console.log(data);
      },
      handleCurrentChange(page) {
        this.pagination.pageNo = page;
        //this.getData(this.pagination.pageSize, page);
      },
      handleSizeChange(size) {
        this.pagination.pageSize = size;
        //this.getData(size, this.pagination.pageNo);
      },
    }
  }
</script>

<style scoped lang="scss">
  .search{
    margin-bottom: 10px;
  }
  /deep/.el-select{
    width: 100%;
  }
  .addDev {
    /deep/.el-form-item__content {
      display: flex;
    }
  }
  /deep/.el-divider{
    background: #409eff;
  }
  /deep/.el-divider__text{
    font-size: 18px;
    color: #409eff;
  }
  /deep/.el-date-editor.el-input, .el-date-editor.el-input__inner {
    width: 100%
  }
</style>
